package com.dk.shared.utils;

import com.dk.common.model.UserDTO;
import com.dk.common.utils.AuditorAware;
import lombok.extern.slf4j.Slf4j;

import java.util.Optional;

@Slf4j
public class UserAuditorAware implements AuditorAware {
    @Override
    public Optional<String> getCurrentAuditorName() {
        return UserAuditorHelper.getCurrentUser().map(UserDTO::getUserName);
    }

    @Override
    public Optional<Long> getCurrentAuditor() {
        return UserAuditorHelper.getCurrentUser().map(UserDTO::getId);
    }


}
